function addText() {
	//Add text that player has wrote to chat input
	var plname=$('#pl1_name').html();
	var userInput = document.getElementById('userInput').value;
	olist = document.getElementById('list');
	op = document.createElement('div');
	op.innerHTML = plname+": "+userInput;
	ocontent = document.getElementById('chat_content');
	ocontent.appendChild(op);
	olist.scrollTop = olist.scrollHeight;
}

function addlog(k,words){
	//Adds any kind of log information, that is displayed as Dealer:
	var plname=$("#pl"+k+"_name").html();
	text = document.createElement('div');
	if (k==0){
		text.innerHTML = "Dealer: "+words;
	}
	else{
		text.innerHTML = "Dealer: player "+plname+" - "+words;
	}
	$('#chat_content').append(text);
}

function exitwindow(){
	//Function to exit the game(works only if it is open by javascript)
	var x=confirm("Are you sure you want to exit?");
	if (x==true){
		window.close();
	}
}

function restartgame(){
	//Refresh the window, that makes the game to restart
	var x=confirm("Are you sure you want to restart the game?");
	if (x==true){
		history.go();
	}
}

function addyourname(){
	//Function to replace the name of the player at start of the game
	var name = prompt("What is your name?", "Unnamed");
	$("#pl1_name").html(name);
}